package com.acme.task1;

public class Calculator {
	public static void main(String[] args) {
		
		if(args.length != 3){
			System.out.println("Count of parameters must be = 3");
			return;
		}
		
		double operand1 = 0;
		double operand2 = 0;
		double res = 0;
		
		//get arguments
		try{
			operand1 = Double.parseDouble(args[0]);
			operand2 = Double.parseDouble(args[2]);
		}catch (NumberFormatException e) {
			System.out.println("Operands must be digit values");
			return;
		}
		
		//analyze operation and make calculations
		char operation = args[1].charAt(0);
		
		switch (operation) {
		case 42:
			res = operand1 * operand2;
			break;
		case 43:
			res = operand1 + operand2;
			break;
		case 45:
			res = operand1 - operand2;
			break;
		case 47:
			res = operand1 / operand2;
		default:
			System.out.println("Operation must be in '*', '+', '-', '/'");
			return;
		}
		
		System.out.println(res);
		

	}
}
